package com.woniuxy.microgoodsserver.auctionmag.mapper;

import com.woniuxy.microgoodsserver.bean.GoodsBrandBean;
import com.woniuxy.microgoodsserver.bean.GoodsNumble;
import org.apache.ibatis.annotations.*;

@Mapper
public interface GoodsNumbleMapper {
    //商品编号通过id查询
    @Select("select id,numble_name as numbleName,numble from goods_numble where id = #{id} and del_status=0")
    GoodsNumble numbleFindAllById(@Param("id")int id);

    //商品编号分页查询



    //编号增加
    @Options(useGeneratedKeys = true,keyProperty = "n.id")
    @Insert("insert into goods_numble " +
            "(numble_name,numble,del_status)" +
            " values(#{n.numbleName},#{n.numble},'0')")
    int SaveNum(@Param("n") GoodsNumble goodsNumble);


    //编号修改
    @Update("<script>" +
            "update goods_numble" +
            "<set>" +
            "<if test='n.numbleName != null'>" +
            " numble_name = #{n.numbleName}," +
            "</if>" +
            "<if test='n.numble != null'>" +
            " numble = #{n.numble}," +
            "</if>" +
            "</set>" +
            "where id = #{n.id}" +
            "</script>")
    int updateGoodsNumble(@Param("n") GoodsNumble goodNumble);

    //编号删除
    @Update("<script>" +
            "update goods_numble" +
            "<set>" +
            " del_status = '1'" +
            "</set>" +
            "where id = #{n.id}" +
            "</script>")
    int delGoodsNumble(@Param("n") GoodsNumble goodNumble);
}
